/*MyPhotoIndex Free Photo Organizer <www.myphotoindex.com>
  Copyright (C) <2006-2009>  <Asaf Yarkoni asaf@yarkoni.net>

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using MyPhotoIndex.Interfaces.ImageFormatProviders;

namespace MyPhotoIndex.Interfaces.Imaging
{
    public enum ImageResolutionUnit { Invalid = 0, Unknown = 1, Inch = 2, Centimeter = 3 }
    public enum CameraExposureProgram
    {
        NotDefined = 0, Manual = 1, NormalProgram = 2, AperturePriority = 3,
        ShutterPriority = 4, CreativeProgram = 5, ActionProgram = 6,
        PortraitMode = 7, LandscapeMode = 8
    }

    public enum CameraMeteringMode
    {
        Unknown = 0, Average = 1, CenterWeightedAverage = 2,
        Spot = 3, MultipleSpot = 4, Pattern = 5,
        Partial = 6, Other = 7
    }

    public enum ImageLightSource
    {
        Unknown = 0, Daylight = 1, Fluorescent = 2, Tungsten = 3, Flash = 4,
        FineWeather = 9, Cloudy = 10, Shade = 11, DaylightFluorescent = 12,
        DayWhiteFluorescent = 13, CoolWhiteFluorescent = 14, WhiteFluorescent = 15,
        StandardLightA = 17, StandardLightB = 18, StandardLightC = 19,
        D55 = 20, D65 = 21, D75 = 22, D50 = 23, IsoStudioTungsten = 24, Other = 255
    }

    public enum CameraFlashStatus
    {
        NoFlash = 0x0, Fired = 0x1, FiredReturnNotDetected = 0x5, FiredReturnDetected = 0x7,
        OnDidNotFire = 0x8, On = 0x9, OnReturnNotDetected = 0xd, OnReturnDetected = 0xf,
        Off = 0x10, OffDidNotFireReturnNotDetected = 0x14, AutoDidNotFire = 0x18, AutoFired = 0x19,
        AutoFiredReturnNotDetected = 0x1d, AutoFiredReturnDetected = 0x1f, NoFlashFunction = 0x20,
        OffNoFlashFunction = 0x30, FiredRedeyeReduction = 0x41, FiredRedeyeReductionReturnNotDetected = 0x45,
        FiredRedeyeReductionReturnDetected = 0x47, OnRedeyeReduction = 0x49, OnRedeyeReductionReturnNotDetected = 0x4d,
        OnRedeyeReductionReturnDetected = 0x4f, OffRedeyeReduction = 0x50, AutoDidNotFireRedeyeReduction = 0x58,
        AutoFiredRedeyeReduction = 0x59, AutoFiredRedeyeReductionReturnNotDetected = 0x5d, AutoFiredRedeyeReductionReturnDetected = 0x5f
    }

    public delegate void ImageLoadDelegate(IImageData imageData, Image image, object tag); 

    public enum ImageLinkStatus { NotValidated = 0, Valid, Invalid }

    public interface IImageData : IDisposable
    {
        event EventHandler ImageDataChangedEvent;
        void InvokeChangedEvent();

        int Id
        {
            get;
            set;
        }

        Object SyncLock
        {
            get;
        }

        string ImportBatchNumber
        {
            get;
            set;
        }

        DateTime DateTaken
        {
            get;
            set;
        }

        DateTime DateDigitized
        {
            get;
            set;
        }

        Image Thumbnail
        {
            get;
            set;
        }

        int ThumbnailReferences
        {
            get;
            set;
        }

        string FileName
        {
            get;
            set;
        }

        string FileExtention
        {
            get;
        }

        IImageFormatProvider FormatProvider
        {
            get;
        }

        Size ImageSize
        {
            get;
            set;
        }

        Size ThumbnailSize
        {
            get;
            set;
        }

        ImageLinkStatus LinkStatus
        {
            get;
            set;
        }

        string Comment
        {
            get;
            set;
        }

        int[] Tags
        {
            get;
        }

        void AddTags(int[] tagIds);
        void RemoveTag(int tagId);
        void ClearTags();
        bool TagExists(int tagId);

        int Rating
        {
            get;
            set;
        }

        bool IsVideo
        {
            get;
        }

        bool CanRotate
        {
            get;
        }

        bool Encrypted
        {
            get;
        }

        string CameraMaker
        {
            get;
        }

        string CameraModel
        {
            get;
        }

        string SoftwareUsed
        {
            get;
        }

        float Aperture
        {
            get;
        }

        String ExposureTime
        {
            get;
        }

        CameraExposureProgram ExposureProgram
        {
            get;
        }

        int IsoSpeed
        {
            get;
        }

        int ExposureCompensation
        {
            get;
        }

        CameraMeteringMode MeteringMode
        {
            get;
        }

        ImageLightSource LightSource
        {
            get;
        }

        CameraFlashStatus FlashStatus
        {
            get;
        }

        float FocalLength
        {
            get;
        }

        String FileSignature
        {
            get;
            set;
        }

        DateTime LastModified
        {
            get;
            set;
        }

        int[] Categories
        {
            get;
        }

        int VersionsCount
        {
            get;
            set;
        }

        int VersionParentId
        {
            get;
            set;
        }

        DateTime VersionDate
        {
            get;
            set;
        }

        string SourceLabel
        {
            get;
            set;
        }

        void AddCategories(int[] categoryIds);
        void RemoveCategory(int categoryId);
        void ClearCategories();
        bool CategoryExists(int tagId);

        void Rotate(RotateFlipType rotationType);

        void Delete(bool deleteFromDisk, bool sendToRecycleBin);

        void Update(bool updateExif, bool updateThumbnail);

        void LoadImage(Size requestedSize, ImageLoadDelegate imageLoadDelegate);

        Image CreateThumbnail(Size size);
    }
}
